#include "InterFace.h"

InterFace *InterFace::m_instance = nullptr;

InterFace::InterFace(QObject *parent)
{
    m_page_index = PAGE_HOME;
    m_prev_page_index = -1;
}
InterFace *InterFace::GetInstance()
{
    if(m_instance == nullptr)
        return new InterFace();
    return m_instance;
}

InterFace::~InterFace()
{

}

int InterFace::GetPageIndex() const
{
    return m_page_index;
}

void InterFace::SetPageIndex(int index)
{
    if(m_page_index != m_page_index)
        m_prev_page_index = m_page_index;

    if(m_page_index == index || index < 0 )
        return;

    m_page_index = index;
    emit SignPageIndexChanged();
}

int InterFace::GetPrevPageIndex() const
{
    return m_prev_page_index;
}

void InterFace::SetPrevPageIndex(int index)
{
    if(m_prev_page_index == index)
        return;
    m_prev_page_index = index;

    emit SignPrevPageChanged();
}

int InterFace::GetPageSetting() const
{
    return PAGE_SETTING;
}

int InterFace::GetPageHome() const
{
    return PAGE_HOME;
}

int InterFace::GetPageRpi() const
{
    return PAGE_RPI;
}

int InterFace::GetPageTest() const
{
    return PAGE_TEST;
}
